//---------------------------------------------------------------------------

#ifndef ComputerH
#define ComputerH


typedef enum
{
	COMP_R_HEAD1 					= 0,
	COMP_R_MOTION_MODE		= 1,
	COMP_R_CONT_DIS_L			= 2,
	COMP_R_CONT_DIS_H			= 3,
	COMP_R_CONT_ANGLE_L		= 4,
	COMP_R_CONT_ANGLE_H		= 5,
	COMP_R_HEAD_MODE			= 6,
	COMP_R_MOTOR_0_L			= 7,
	COMP_R_MOTOR_0_H			= 8,
	COMP_R_MOTOR_1_L			= 9,
	COMP_R_MOTOR_1_H			= 10,
	COMP_R_CHECKSUM				= 11,
	COMP_R_LENGTH				  = 12
} CompReceiveDef; // Receive data from Comp

typedef enum
{
	COMP_S_HEAD1					= 0,
	COMP_S_HEAD2					= 1,
	COMP_S_DIP						= 2,
	COMP_S_MOTOR_0_L			= 3,
	COMP_S_MOTOR_0_H			= 4,
	COMP_S_MOTOR_1_L			= 5,
	COMP_S_MOTOR_1_H			= 6,
	COMP_S_MOTOR_2_L			= 7,
	COMP_S_MOTOR_2_H			= 8,
	COMP_S_MOTOR_3_L			= 9,
	COMP_S_MOTOR_3_H			= 10,
	COMP_S_MOTOR_4_L			= 11,
	COMP_S_MOTOR_4_H			= 12,
	COMP_S_MOTION_DONE		= 13,
	COMP_S_AZIMUTH_L			= 14,
	COMP_S_AZIMUTH_H			= 15,
	COMP_S_CHECKSUM				= 16,
	COMP_S_LENGTH					= 17
}	CompSendDef; // Send data to Comp

typedef struct
{
	unsigned char Buff[COMP_RX_BUFF_SIZE];
	int NowIndex;
	int EndIndex;
} CompRXStruct;


extern unsigned char Comp_Receive[COMP_R_LENGTH];
extern unsigned char Comp_Send[COMP_S_LENGTH];
extern CompRXStruct CompRX;

void Comp_Init(void);
void Comp_Receive_Init(void);
void Comp_Send_Init(void);
void CompRX_Init(void);
// Used when communicate with Computer through RS232
bool CompRX2Receive(void);
void CompSend(void);
void Receive2Motion(void);
// Used when communicate with Computer through Share memory
void Comp_StoreToShareM(void);
void Comp_LoadFromShareM(void);


//---------------------------------------------------------------------------
#endif
